/************************************************************************************
* PlaylistManager.h                                                                        *
*                                                                                   *
* Copyright (C) 2011 Varuna L Amachi                                              *
*                                                                                   *
* This program is free software; you can redistribute it and/or modify              *
* it under the terms of the GNU General Public License as published by              *
* the Free Software Foundation; either version 2 of the License, or any             *
* later version.                                                                    *
*                                                                                   *
* This program is distributed in the hope that it will be useful, but               *
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY        *
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for       *
* more details. You should have received a copy of the GNU General Public           *
* License along with this program; if not, write to the Free Software Foundation,   *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                       *
*                                                                                   *
*************************************************************************************/ 

#ifndef PLAYLISTMANAGER_H
#define PLAYLISTMANAGER_H

#include <QAbstractItemModel>
#include <QList>
#include <QHash>

#include "SavedPlaylist.h"
#include "collector/CollectorItem.h"

class PlaylistManager : public QAbstractItemModel
{
    Q_OBJECT

    QHash<QString, SavedPlaylist *> *m_playlistMap;
    QList<SavedPlaylist *> m_playlists;

private slots:
    void resetList();
public:
    explicit PlaylistManager(QObject *parent = 0);

    QList<SavedPlaylist *> getPlaylists();
    SavedPlaylist *getPlaylist(QString playlistName);
    void addPlaylist(SavedPlaylist *playlist);
    void removePlaylist(QString playlistName);

    int rowCount(const QModelIndex &parent) const;
    int columnCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;
    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    QModelIndex index(int row, int column, const QModelIndex &parent) const;
    QModelIndex parent(const QModelIndex &child) const;
    bool hasChildren(const QModelIndex &parent) const;
    
signals:
    void savedPlaylistChanged(QString playlistName);
    
public slots:

    
};

#endif // PLAYLISTMANAGER_H
